module.exports = {
    exception_handler:  async (ctx, next) => {
        try {
          await next();
         // console.log(`api--->${ctx.method} ${ctx.url}`);
          // user = JSON.stringify(ctx.session.user);
          // console.log(`Current User is: ${user}`);
          // console.log('=========ctx',ctx.request.body)
        } catch (err) {
          // console.log('error --->')
          // console.log(err)
          ctx.body = {
            code: -1,
            message: '出现未知错误!'
          }
        }
      },
    response_handler: async function (ctx, next) {
        ctx.constantResData = function (CONSTANTDATA, data = {}) { 
          return {
            ...CONSTANTDATA,
            data: data
          }
        }
        await next();
      }
}